/**
* Oxide
*
* Copyright (c) 2011 Dinosaur Kick Pty Ltd, All rights reserved.
*
* This source code is made available under the "Modified BSD" licensing arrangement.
* See license.txt for details.
*/
// ----------------------------------------------------------------------------
#include <functional>
#include <string>
// ----------------------------------------------------------------------------
#ifndef O2_COMPARITOR_INC
#define O2_COMPARITOR_INC
namespace o2 {
// ----------------------------------------------------------------------------

template <typename LeftT, typename RightT>
struct comparator
	: public std::binary_function<LeftT, RightT, int>
{
	int operator() (const LeftT& left, const RightT& right) const
	{
		return left - right;
	}
};

template <typename CharT, typename TraitsT, typename AllocT>
struct comparator<std::basic_string<CharT, TraitsT, AllocT>, std::basic_string<CharT, TraitsT, AllocT> >
	: public std::binary_function<std::basic_string<CharT, TraitsT, AllocT>, std::basic_string<CharT, TraitsT, AllocT>, int>
{
	int operator() (const std::basic_string<CharT, TraitsT, AllocT>& left, const std::basic_string<CharT, TraitsT, AllocT>& right) const
	{
		return left.compare(right);
	}
};

// ----------------------------------------------------------------------------
} // namespace o2
#endif // O2_COMPARITOR_INC
// ----------------------------------------------------------------------------
